<meta charset="utf-8">
<?php
//var_dump($_POST);
include('link.php');
if(isset($_POST['submit']) && $_POST['submit']=='注册'){
    $email=$_POST['email'];
    $name=$_POST['name'];
    $pwd=$_POST['password'];
    $confirm=$_POST['confirm'];
   if($email==''||$name==''||$pwd==''||$confirm==''){
echo "请输入完整内容";
   }else{
       if($pwd!=$confirm){
           echo "请两次密码输入一致";
       }else{
           $sql="use study12";
            mysqli_query($conn,$sql);
           $sql="select * from php1 where eamil ='$email'";
            // var_dump($sql);
           $rs=mysqli_query($conn,$sql);
            //    var_dump($rs);
           //var_dump(mysqli_num_rows($rs));
           //@$a=mysqli_num_rows($rs);
           if(mysqli_num_rows($rs)){
            echo '该用户已存在';
           }else{
               $sql="insert into php1(eamil,name,password)value('$email ','$name','$pwd')";
                   $a=mysqli_query($conn,$sql);
                   if($a){
                       echo "注册成功";
                   }else{
                       echo '注册失败';
                   }
           }
       }
   }
}
?>